package cn.codeforfun.cloud.center.client.configuration;

import cn.codeforfun.cloud.center.client.constants.ClientProperties;
import cn.codeforfun.cloud.center.client.core.CloudClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import javax.annotation.Resource;

@Configuration
@EnableConfigurationProperties({ClientProperties.class})
public class ClientConfiguration {
    @Resource
    Environment environment;

    @Resource
    ClientProperties clientProperties;

    @Bean
    public CloudClient initializeClient() {
        CloudClient client = new CloudClient();
        client.start(clientProperties, environment);
        return client;
    }

}
